package org.example.domain;

import jakarta.validation.constraints.Min;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.hibernate.validator.constraints.Range;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author: sql
 * @date: 2024/6/7
 * @Description: 分页表单，从page开始分页，每一页显示limit
 * @version: 1.0
 */
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class PageQuery implements Serializable {

    @Serial
    private static final long serialVersionUID = 6094298514687248499L;

    /**
     * 当前页,默认为1
     */
    @Min(value = 1, message = "当前分页必须大于等于 1")
    private Long pageNumber = 1L;

    /**
     * 显示数（默认值：10，最大值：5000）
     */
    @Range(min = 1, max = 5000, message = "每页分页个数只能在1 - 5000之间")
    private Long pageSize = 10L;

}
